import 'package:get/get.dart';
import 'package:hc_bot_kit/service/service.dart';
import 'package:hc_bot_kit/state.dart';
import 'package:hc_bot_kit_example/guide/widgets/progress_view.dart';

class GuideController extends GetxController {
  List<String> _poiList = [];

  List<String> get poiList => _poiList;

  String get originalPoi => Get.find<RobotHardwareService>().originPoi;

  GuideController() {}

  _initData() async {
    final service = Get.find<RobotHardwareService>();
    await service.connect();
    await Future.delayed(2.seconds);
    _poiList = await service.getAllPoi();
    update(["guide"]);
  }

  void onTap(String dst) async {
    await Get.find<RobotHardwareService>().guide(dst);
    Get.dialog(ProgressView());
  }

  // @override
  // void onInit() {
  //   super.onInit();
  // }

  @override
  void onReady() {
    super.onReady();
    _initData();
  }

  // @override
  // void onClose() {
  //   super.onClose();
  // }
}
